package cn.antblog.sort;

/**
 * description: ZjSelectSort 直接选择排序
 * date: 2020/9/29 11:33
 * author: YangJy
 */
public class ZjSelectSort {

    public static void main(String[] args) {
        zjSelectSort();
    }

    private static void zjSelectSort() {
        int num[] = {5, 23, 86, 21, 43, 67, 45, 34, 58, 23, 102, 123, 11, 22, 1};
        int min, temp;
        for (int i = 0; i < num.length; i++) {
            min = num[i];
            temp = i;
            for (int j = i+1; j < num.length; j++) {
                if (min > num[j]) {
                    temp = j;
                    min = num[j];
                }
            }
            num[temp] = num[i];
            num[i] = min;
        }
        for (int i : num) {
            System.out.print(i + "|");
        }
    }
}
